const {HttpException, error} = require("../util");
const {initModels, Cors} = require("../models/init-models");
const {sequelize} = require("../util/mysqlConnection");
const router = require('koa-router')()


// initModels(sequelize).cors.
router.get('/', async (ctx, next) => {
    await ctx.render('index', {
        title: 'Hello Koa 2!',
        list: await Cors.findAll(),
    })
})

router.get('/string', async (ctx, next) => {
    ctx.body = 'koa2 string'
})

router.get('/json', async (ctx, next) => {
    ctx.body = {
        title: 'koa2 json'
    }
})

module.exports = router
